// export default () => <div>Welcome to next.js!</div>
import React from 'react'
import Link from 'next/link'
import {Form, Icon, Input, Button, Checkbox} from 'antd'
import FirstAdd from './components/firstAdd'
import ContentText from './components/contentText'
import Banners from './components/banner'
import {textApi,postTest} from '../api'
import {connect} from 'react-redux'
import {loadData, startClock, tickClock} from './store/action'
import '../static/style/essay.less'
class App extends React.Component{
    static async getInitialProps (props) {
        const { store, isServer } = props.ctx
        // store.dispatch(tickClock(isServer))
    
        // if (!store.getState().placeholderData) {
        //   store.dispatch(loadData())
        // }
        // store.dispatch({
        //     type:'fetchInfor',
        //     payload:123233
        // })
    
        return { isServer:store.getState()}
      }
    constructor(props){
        super(props)
        this.state = {
          
        }
    }

    async componentDidMount(){
        let token = localStorage.getItem('TOKEN');
        textApi('/getListInfor',{sd:123,df:333,token}).then((res) =>{
            console.log(res)
        })
         this.props.dispatch({
            type:'fetchInfor',
            payload:123233

        })
        console.log(this.props)
    }


    render(){
        
        return(
            <div className="container">
                <FirstAdd/>
                <Banners/>
                <section className="fix_r">
                    <section className="content_left">
                        <ContentText/>
                        <ContentText/>
                        <ContentText/>
                        <ContentText/>
                        <ContentText/>
                        <ContentText/>
                    </section>
                    <section className="content_right fix_h">
                        <div className="hot_text">
                            <h3 className="title">
                                <span className="iconfont icon-huo"></span>
                                Hot ! Hot ! Hot ! 
                            </h3>
                            <p className="hot_content">
                                <span className="hotIndex">1</span>
                                <a className="hotWords">第一名的文章</a>
                            </p>
                            <p className="hot_content">
                                <span className="hotIndex">2</span>
                                <a className="hotWords">第一名的文章</a>
                            </p>
                            <p className="hot_content">
                                <span className="hotIndex">3</span>
                                <a className="hotWords">第一名的文章</a>
                            </p>
                        </div>
                        <div className="youLike"></div>
                    </section>
                </section>
            </div>
            
        )
    }
}

const mapStateToProps = (state) => {
    return {
       infor:state
    };
}


export default connect(mapStateToProps)(App)
